package cloud.keveri.example.response4j.func;

import cloud.keveri.example.response4j.interfaces.TestController;
import cloud.keveri.response4j.skip.SkipWrapCheckFunction;
import org.springframework.core.MethodParameter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.lang.NonNull;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;

/**
 * <p>
 * 作者：沈自在
 **/
@Component
public class CustomSkip implements SkipWrapCheckFunction {
    @Override
    public boolean isSkip(@NonNull MethodParameter methodParameter,
                          @NonNull Class<? extends HttpMessageConverter<?>> converterType) {
        Method method = methodParameter.getMethod();
        assert method != null;
        Class<?> returnType = method.getReturnType();
        return returnType == TestController.User.class;
    }
}
